package com.example.knowledgeget1.KnowtCommon.Repository;

import com.example.knowledgeget1.KnowtCommon.Entity.Teach;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TeachRepository extends JpaRepository<Teach, Long> {
    // 根据课程id获取教师id
    Teach findTeaIdByCourseId(Long courseId);

    // 根据教师id获取课程id
    @Query("SELECT t.courseId FROM Teach t WHERE t.teaId = ?1")
    List<Long> findCourseIdsByTeacherId(Long stuId);
}